<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/6
 * Time: 15:18
 */
namespace app\web\controller;
use think\Db;
use cmf\controller\HomeBaseController;
class LinkController extends HomeBaseController{

    /**
     * 获取友情链接
     */
    public function getLink(){
        $param = $this->request->param();
        $getLinkList = Db::name('link')->where(['status' => 1])->order(['list_order' => 'asc','id' => 'desc'])->select()->toArray();
        foreach ($getLinkList as $k=>$val){
            $getLinkListNew[$k]['linkId'] = $val['id'];
            if ($param['languageType'] == 1){
                $getLinkListNew[$k]['name'] = $val['name'];
            }else{
                $getLinkListNew[$k]['name'] = $val['english_name'];
            }
            $getLinkListNew[$k]['url'] = $val['url'];
        }
        return $this->json('0','请求成功',$getLinkListNew);
    }
}